import json
import uuid
from fastapi import APIRouter
from logzero import logger
from starlette.background import BackgroundTasks
import os
import time
from server.app import fast_api_server
import asyncio
from server.models.models import *
schedule_router = APIRouter()

@asyncio.coroutine
def train_job(data: TrainModel):
    print(data)

@schedule_router.post("/dict/")
@asyncio.coroutine
def train(data:TrainModel,background_tasks: BackgroundTasks):
    print(data)

    background_tasks.add_task(train_job, data)
    return {"uid": 1}
